<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class check</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Contract 1.0.0">
<link rel="up" href="../../reference.html#header.boost.contract.check_hpp" title="Header &lt;boost/contract/check.hpp&gt;">
<link rel="prev" href="condition_if.html" title="Function template condition_if">
<link rel="next" href="constructor.html" title="Function template constructor">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="condition_if.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.check_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="constructor.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.contract.check"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class check</span></h2>
<p>boost::contract::check — RAII object that checks the contracts. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../reference.html#header.boost.contract.check_hpp" title="Header &lt;boost/contract/check.hpp&gt;">boost/contract/check.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="check.html" title="Class check">check</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="check.html#boost.contract.checkconstruct-copy-destruct">construct/copy/destruct</a></span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> <a class="link" href="check.html#idm45125848808992-bb"><span class="identifier">check</span></a><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="check.html#idm45125848801616-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="check.html" title="Class check">check</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> VirtualResult<span class="special">&gt;</span> 
    <a class="link" href="check.html#idm45125848798720-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify__idm45125848100512.html" title="Class template specify_precondition_old_postcondition_except">specify_precondition_old_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> VirtualResult<span class="special">&gt;</span> 
    <a class="link" href="check.html#idm45125848789440-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify__idm45125848167328.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> VirtualResult<span class="special">&gt;</span> 
    <a class="link" href="check.html#idm45125848778400-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify__idm45125848129264.html" title="Class template specify_postcondition_except">specify_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="check.html#idm45125848767312-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify_except.html" title="Class specify_except">specify_except</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="check.html#idm45125848758128-bb"><span class="identifier">check</span></a><span class="special">(</span><a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="check.html#idm45125848748928-bb"><span class="special">~</span><span class="identifier">check</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm45885987333568"></a><h2>Description</h2>
<p>In general, when this object is constructed it checks class invariants at entry, preconditions, and makes old value copies at body. When it is destructed, it checks class invariants at exist, postconditions, and exception guarantees. This object enforces the following (see  <a class="link" href="../../boost_contract/contract_programming_overview.html" title="Contract Programming Overview"> Contract Programming Overview</a>):</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>Postconditions are checked only if the body does not throw an exception. </p></li>
<li class="listitem"><p>Exceptions guarantees are checked only if the body throws an exception. </p></li>
<li class="listitem"><p>Constructor entry never checks class invariants. </p></li>
<li class="listitem"><p>Destructor exit checks class invariants only if the body throws an exception (even if destructors should usually not be programmed to throw exceptions in C++ and they are implicitly declared <code class="computeroutput">noexcept</code> since C++11). </p></li>
<li class="listitem"><p>Static invariants are always checked at entry and exit (and regardless of the body throwing exceptions or not).</p></li>
</ul></div>
<p>
When used this way, this object is constructed and initialized to the return value of one of the contract functions <code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code>,  <code class="computeroutput"><a class="link" href="constructor.html" title="Function template constructor">boost::contract::constructor</a></code>, <code class="computeroutput"><a class="link" href="destructor.html" title="Function template destructor">boost::contract::destructor</a></code>, or <code class="computeroutput"><a class="link" href="public_f_idm45125847806592.html" title="Function template public_function">boost::contract::public_function</a></code>. In addition to that, this object can be constructed from a nullary functor when it is used to program implementation checks.</p>
<p><span class="bold"><strong>See Also:</strong></span></p>
<p> <a class="link" href="../../boost_contract/tutorial.html" title="Tutorial"> Tutorial</a>,  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.implementation_checks" title="Implementation Checks"> Implementation Checks</a> </p>
<p>
</p>
<p>
</p>
<div class="refsect2">
<a name="idm45885987318304"></a><h3>
<a name="boost.contract.checkconstruct-copy-destruct"></a><code class="computeroutput">check</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> F<span class="special">&gt;</span> <a name="idm45125848808992-bb"></a><span class="identifier">check</span><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&amp;</span> f<span class="special">)</span><span class="special">;</span></pre>Construct this object for implementation checks. <p>This can be used to program checks within implementation code (body, etc.). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use assignment syntax <code class="computeroutput">=</code>.</p>
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
            Throw on Failure</a>).</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">f</code></span></p></td>
<td><p>Nullary functor that asserts implementation checks. <code class="computeroutput">f()</code> will be called as soon as this object is constructed at the point it is declared within the implementation code (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.implementation_checks" title="Implementation Checks">
            Implementation Checks</a>). </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm45125848801616-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="check.html" title="Class check">check</a> <span class="keyword">const</span> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>Construct this object copying it from the specified one. <p>This object will check the contract, the copied-from object will not (i.e., contract check ownership is transferred from the copied object to the new object being created by this constructor).</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">other</code></span></p></td>
<td><p>Copied-from object. </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> VirtualResult<span class="special">&gt;</span> 
  <a name="idm45125848798720-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify__idm45125848100512.html" title="Class template specify_precondition_old_postcondition_except">specify_precondition_old_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry (if those were specified for the given contract). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use assignment syntax <code class="computeroutput">=</code>.</p>
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
            Throw on Failure</a>).</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
<td><p>Contract to be checked (usually the return value of  <code class="computeroutput"><code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code></code> or  <code class="computeroutput"><code class="computeroutput"><a class="link" href="public_f_idm45125847806592.html" title="Function template public_function">boost::contract::public_function</a></code></code>).</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Template Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">VirtualResult</code></span></p></td>
<td><p>Return type of the enclosing function declaring the contract if that is either a virtual or an overriding public function, otherwise this is always <code class="computeroutput">void</code>. (Usually this template parameter is automatically deduced by C++ and it does not need to be explicitly specified by programmers.) </p></td>
</tr></tbody>
</table></div></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> VirtualResult<span class="special">&gt;</span> 
  <a name="idm45125848789440-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify__idm45125848167328.html" title="Class template specify_old_postcondition_except">specify_old_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry and preconditions (if any of those were specified for the given contract). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use assignment syntax <code class="computeroutput">=</code>.</p>
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
            Throw on Failure</a>).</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
<td><p>Contract to be checked (usually the return value of  <code class="computeroutput"><code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="constructor.html" title="Function template constructor">boost::contract::constructor</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="destructor.html" title="Function template destructor">boost::contract::destructor</a></code></code>, or  <code class="computeroutput"><code class="computeroutput"><a class="link" href="public_f_idm45125847806592.html" title="Function template public_function">boost::contract::public_function</a></code></code>).</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Template Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">VirtualResult</code></span></p></td>
<td><p>Return type of the enclosing function declaring the contract if that is either a virtual or an overriding public function, otherwise this is always <code class="computeroutput">void</code>. (Usually this template parameter is automatically deduced by C++ and it does not need to be explicitly specified by programmers.) </p></td>
</tr></tbody>
</table></div></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> VirtualResult<span class="special">&gt;</span> 
  <a name="idm45125848778400-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify__idm45125848129264.html" title="Class template specify_postcondition_except">specify_postcondition_except</a><span class="special">&lt;</span> <span class="identifier">VirtualResult</span> <span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry and preconditions then it makes old value copies at body (if any of those were specified for the given contract). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use assignment syntax <code class="computeroutput">=</code>.</p>
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify contract failure handlers that throw exceptions instead of terminating te program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
            Throw on Failure</a>).</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
<td><p>Contract to be checked (usually the return value of  <code class="computeroutput"><code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="constructor.html" title="Function template constructor">boost::contract::constructor</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="destructor.html" title="Function template destructor">boost::contract::destructor</a></code></code>, or  <code class="computeroutput"><code class="computeroutput"><a class="link" href="public_f_idm45125847806592.html" title="Function template public_function">boost::contract::public_function</a></code></code>).</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Template Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">VirtualResult</code></span></p></td>
<td><p>Return type of the enclosing function declaring the contract if that is either a virtual or an overriding public function, otherwise this is always <code class="computeroutput">void</code>. (Usually this template parameter is automatically deduced by C++ and it does not need to be explicitly specified by programmers.) </p></td>
</tr></tbody>
</table></div></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm45125848767312-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify_except.html" title="Class specify_except">specify_except</a> <span class="keyword">const</span> <span class="special">&amp;</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry and preconditions then it makes old value copies at body, plus the destructor of this object will also check postconditions in this case (if any of those were specified for the given contract). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use assignment syntax <code class="computeroutput">=</code>.</p>
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
            Throw on Failure</a>).</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
<td><p>Contract to be checked (usually the return value of  <code class="computeroutput"><code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="constructor.html" title="Function template constructor">boost::contract::constructor</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="destructor.html" title="Function template destructor">boost::contract::destructor</a></code></code>, or  <code class="computeroutput"><code class="computeroutput"><a class="link" href="public_f_idm45125847806592.html" title="Function template public_function">boost::contract::public_function</a></code></code>).</p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm45125848758128-bb"></a><span class="identifier">check</span><span class="special">(</span><a class="link" href="specify_nothing.html" title="Class specify_nothing">specify_nothing</a> <span class="keyword">const</span> <span class="special">&amp;</span> contract<span class="special">)</span><span class="special">;</span></pre>Construct this object to check the specified contract. <p>This checks class invariants at entry and preconditions then it makes old value copies at body, plus the destructor of this object will also check postconditions and exception guarantees in this case (if any of those were specified for the given contract). This constructor is not declared <code class="computeroutput">explicit</code> so initializations can use assignment syntax <code class="computeroutput">=</code>.</p>
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
            Throw on Failure</a>).</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">contract</code></span></p></td>
<td><p>Contract to be checked (usually the return value of  <code class="computeroutput"><code class="computeroutput"><a class="link" href="function.html" title="Function function">boost::contract::function</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="constructor.html" title="Function template constructor">boost::contract::constructor</a></code></code>,  <code class="computeroutput"><code class="computeroutput"><a class="link" href="destructor.html" title="Function template destructor">boost::contract::destructor</a></code></code>, or  <code class="computeroutput"><code class="computeroutput"><a class="link" href="public_f_idm45125847806592.html" title="Function template public_function">boost::contract::public_function</a></code></code>).</p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm45125848748928-bb"></a><span class="special">~</span><span class="identifier">check</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destruct this object. <p>This checks class invariants at exit and either postconditions when the enclosing function body did not throw an exception, or exception guarantees when the function body threw an exception (if class invariants, postconditions, and exception guarantees respectively were specified for the enclosing class and the contract parameter given when constructing this object).</p>
<p><span class="bold"><strong>Throws:</strong></span> This can throw in case programmers specify contract failure handlers that throw exceptions instead of terminating the program (see  <a class="link" href="../../boost_contract/advanced.html#boost_contract.advanced.throw_on_failures__and__noexcept__" title="Throw on Failures (and noexcept)">
            Throw on Failure</a>). (This is declared <code class="computeroutput">noexcept(false)</code> since C++11.) </p>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2008-2019 Lorenzo Caminiti<p>
        Distributed under the Boost Software License, Version 1.0 (see accompanying
        file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="condition_if.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html#header.boost.contract.check_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="constructor.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
